'''
Author: Leo.wang wanglizhigs@163.com
Date: 2025-09-05 20:36:09
LastEditors: Leo.wang wanglizhigs@163.com
LastEditTime: 2025-09-05 21:11:51
FilePath: /medical-companion-server-python/app/user/models.py
Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
'''
from django.db import models

# Create your models here.
from django.db import models
from app.gender.models import McGender  

class McUser(models.Model):


  
    open_id = models.CharField(max_length=100, unique=True, null=False, blank=False)
    phone = models.BigIntegerField(null=True, blank=True, unique=False)
    nick_name = models.CharField(max_length=100, null=True, blank=True)
    real_name = models.CharField(max_length=100, null=True, blank=True)
    # gender = models.PositiveSmallIntegerField(null=True, blank=True)

    # 关键：设为外键，并指定使用同名列
    gender = models.ForeignKey(
        McGender,
        on_delete=models.SET_NULL,
        null=True,
        blank=True,
        db_column="gender_id",
    )
    age = models.PositiveIntegerField(null=True, blank=True)
    avatar = models.CharField(max_length=400, null=True, blank=True)
    created_time = models.DateTimeField(auto_now_add=True)
    updated_time = models.DateTimeField(auto_now=True)

    class Meta:
        db_table = 'mc_user'
        verbose_name = '用户'
        verbose_name_plural = '用户'

